<!DOCTYPE html>
<html>
    <head>
        <title>TODO supply a title</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
<style type="text/css">
table.gridtable {
    font-family: verdana,arial,sans-serif;
    font-size:11px;
    color:#333333;
    border-width: 1px;
    border-color: #666666;
    border-collapse: collapse;
}
table.gridtable th {
    border-width: 1px;
    padding: 8px;
    border-style: solid;
    border-color: #666666;
    background-color: #dedede;
}
table.gridtable td {
    border-width: 1px;
    padding: 8px;
    border-style: solid;
    border-color: #666666;
    background-color: #ffffff;
}
a{
    color: black;
  text-decoration: none;
}
</style>

    </head>
    <body>
    <table class="gridtable">
<tr>
    <th>ID</th><th>姓名</th><th>所属部门</th><th>头像</th><th>出生日期</th><th>入职时间</th><th>相关操作</th>
</tr>
<?php
    require_once'./db_emp_conn.php';
    $sql="SELECT * FROM  `yuangongbiao`";
    $result = $conn->query($sql);
                            ?>
    <?php if ($result->num_rows > 0):?>
    <?php 
    $rows = $result->fetch_all(MYSQLI_ASSOC);
    foreach($rows as $row): ?>  
                           
<tr>
    <td><?php echo $row ['id']; ?></td>
    <td><?php echo $row ['name']; ?></td>
    <td><?php echo $row ['department']; ?></td>
    <td><img src="<?php echo $row ['photo']; ?>"/></td>
    <td><?php echo $row ['birthday']; ?></td>
    <td><?php echo $row ['entry']; ?></td>
    <td> <a class="compile" href="javascript:" onclick="if(confirm('确定编辑吗？')) location.href='Update.php? id=<?php echo $row['id']; ?> ;'" >编辑</a> &nbsp&nbsp  
         <a class="delete" href="javascript:" onclick="if(confirm('确定删除吗？')) location.href='delete.php? id=<?php echo $row['id']; ?>'" >删除</a></td>
</tr>
    <?php endforeach; ?>
    <?php else : ?>
    <p>0个结果</p>
    <?php endif; ?>
</table>
    
    </body>
</html>